﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RoleAdd.aspx.cs" Inherits="Invoicing.sys.RoleAdd" %>

<script src="../js/jquery.ztree.core-3.5.min.js"></script>
<script src="../js/jquery.ztree.excheck-3.5.min.js"></script>
<script src="../js/jquery.ztree.exedit-3.5.min.js"></script>





<script type="text/javascript">
    var myTree;

    //定义树形菜单事件
    function zTreeOnCheck(event, treeId, treeNode) {

        var nodes = myTree.getCheckedNodes(true);
        var str = "";
        $.each(nodes, function (i, data) {
            str = str + data.id.toString() + ","
        });
        $("#treeids").val(str);
    };

    var setting = {
        check: {
            enable: true
        },
        data: {
            simpleData: {
                enable: true
            }
        },
        callback: {
            onCheck: zTreeOnCheck
        }

    };

    var code;
    function showCode(str) {
        if (!code) code = $("#code");
        code.empty();
        code.append("<li>" + str + "</li>");
    }
    $.ajax({
        type: 'post',
        data: 'type=1000',
        url: 'AJAX/MenuTree.ashx',
        cache: false,
        dataType: 'json',
        success: function (data) {
            myTree = $.fn.zTree.init($("#treeDemo"), setting, data.treedata);
        }
    });


    //定义树形菜单事件
    function zTreeOnCheck(event, treeId, treeNode) {

        var nodes = myTree.getCheckedNodes(true);
        var str = "";
        $.each(nodes, function (i, data) {
            str = str + data.id.toString() + ","
        });
        $("#treeids").val(str);

      //  alert(str)
    };


</script>

  

 <div class="pageContent">    
        <form id="form1" method="post" action="AJAX/RoleInfo.ashx" class="pageForm required-validate" onsubmit="return validateCallback(this,dialogAjaxDone)">
        <input type="hidden" name="action" value="add" />
        <input type="hidden" name="treeids" id="treeids" value="" />
            <div class="tabs" currentIndex="0" eventType="click"><!--主体标签-->
            <div class="tabsHeader">
			<div class="tabsHeaderContent">
				<ul>
					<li><a href="javascript:;"><span>基本信息</span></a></li>
			        <li><a href="javascript:;"><span>权限</span></a></li>
				</ul>
			</div>
		</div> <!--tab头部信息-->
           <div class="tabsContent" layoutH="70">
            <div id="tab_base">
                    <div class="pageFormContent" layoutH="50">
                <p>                                       
                    <label>角色名称：</label>
                    <input type="text" name="txtroleName" size="30" maxlength="50"  class="required" alt="请输入名称"  />
                </p>
                <p>
                    <label>角色级别：</label>
                    <select name="rlevel" id="rlevel" class="combox">
                        <option  value="0">高级</option>
                        <option  value="1">中级</option>
                        <option  value="2">低级</option>
                    </select>

                </p>
             
                <p>
                   <label>角色介绍：</label>
                   <textarea name="txtRoleNote" cols="12" style="width:200px" > </textarea>
                </p>
            </div>
               </div>
            <div id="tab_ajax">
                      <ul id="treeDemo" class="ztree">
                      </ul>
             </div>

            </div>

            </div>


            <div class="formBar">
                <ul>
                    <li><div class="buttonActive"><div class="buttonContent"><button type="submit">提交</button></div></div></li>
                    <li><div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div></li>
                </ul>
            </div>
        </form>
    </div>